package com.wn.user.controller;

import com.wn.user.service.MyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yellow Docter
 * @date 2022 -08-30
 * @desc
 */
@RestController
public class HelloController {

    @Autowired
    private MyService myService;

    @GetMapping("/show")
    public String show(){
        return "hello sentinel...";
    }

    @GetMapping("/list/{id}")
    public String list(@PathVariable Integer id) throws Exception {

        if (id == 2){
            throw new Exception("排除异常....");
        }

        return "hello list..." + id;
    }

    //限流
    @GetMapping("/check1")
    public String check1(){
        //业务
        return myService.doSomething();
    }

    //限流
    @GetMapping("/check2")
    public String check2(){
        return myService.doSomething();
    }

}
